package com.tmt.paymentcenter.web.domain;

import lombok.Getter;
import lombok.Setter;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import tmt.usercenter.web.domain.BaseDomain;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;

/**
 * 账户类型
 */
@Getter
@Setter
@Entity
@EntityListeners({AuditingEntityListener.class})
public class AccountType extends BaseDomain implements Serializable {

    @Column(nullable = false, unique = true)
    private String name;

    @Column(nullable = false, unique = true)
    private String code;


    private String remark;

    /**
     * 所有本账户类型的所有账户
     */
    @OneToMany(mappedBy = "accountType", cascade = {CascadeType.REFRESH})
    private List<Account> accounts;

}
